package com.lqk.java;

/**
 * @author lqk
 * @date 2021/10/30 19:52
 */
public class ClassInitTest {
    private static int num = 1;
    static {
        num = 2;
        number=20;
        System.out.println(num);
        //System.out.println(number);// 报错，非法的前向引用
    }

    // 因为在linking（链接）阶段的prepare（准备步骤）number已经初始化，默认赋值是0
    private static int number = 10;

    public static void main(String[] args) {
        System.out.println(ClassInitTest.num);
    }
}
